package pojo;
import java.util.Scanner;
class a{
    public int x(int n){
        if(n<=3)
            return n;
        else
            return x(n-1)+x(n-3);

    }
}

public class text {
    public static void main(String[] args) {
        Scanner c=new Scanner(System.in);
        a zuo=new a();
        while(true){
            int z=c.nextInt();
            if(z==0)
                break;
            System.out.println(zuo.x(z));
        }
    }
    //测试修改
}
